import { SentenceModel } from '../models/sentence';
import { NotFound } from "lin-mizar/lin";
import {MovieModel} from "../models/movie";

class Sentence {
  static async deleteSentence (id) {
    const sentence = await SentenceModel.destroy({
      where: { id }
    });
    return sentence;
  }
  static async editSentence (id, params) {
    const sentence = await SentenceModel.findByPk(id);
    if (!sentence) {
      throw new NotFound();
    }
    const s = await sentence.update({ ...params });
    return s;
  }
  static async getSentenceList () {
    const sentence = await SentenceModel.findAll();
    return sentence;
  }
  static async addSentence (cv) {
    const sentence = await SentenceModel.create(cv);
    return sentence;
  }
}
export { Sentence as SentenceDao };